
public class DotComBust {
    private GameHelper helper = new GameHelper();
    private ArrayList<dotCom> dotComList = new ArrayList<dotCom>();
    private int numOfGuesses = 0;

    public void setUpGame(){
        dotCom[] dotcom = new dotCom[3];
        
        dotcom[0].name = "Go2.com";
        dotcom[1].name = "Pets.com";
        dotcom[2].name = "AskMe.com"; //Use setter instead
        
        dotComList.add(dotcom[0]);
        dotComList.add(dotcom[1]);
        dotComList.add(dotcom[2]);
        
        for(dotCom item:dotComList){
            item.location = helper.placeDotCom();
        }
    }
    
    public void startPlaying(){
        String userInput = "";
        while(dotComList.size() > 0){
            userInput = helper.getUserInput();
            checkUserGuess(userInput);
        }
    }

    public String checkUserGuess(String userinput){
        numOfGuesses++;
        String state = "miss";
        for(dotCom item:dotComList){
            state = item.checkYourself(userinput);
            if(state == "hit"){
                break;
            }
            else if(state == "kill"){
                dotComList.remove(item);
            }
        }
    }

    public void finishGame(){
        System.out.println("Game Over");
        if (numOfGuesses < 15){
            System.out.println("Number of Guess below 15, good job!");
        }
        else{
            System.out.println("Good luck next time!");
        }
    }
    
}
